<template>
	<view>
		<uni-popup ref="popup_message" type="message">
			<uni-popup-message :type="message_type" :message="message" :duration="2000"></uni-popup-message>
		</uni-popup>
		<uni-popup ref="popup_dialog" type="dialog">
			<uni-popup-dialog :content="message" @confirm="confirm"></uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script>
	import uniPopup from '@/components/uni-popup/uni-popup.vue'
	import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue'
	import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
	
	export default {
		name: 'UniPopup',
		components:{
			uniPopup,
			uniPopupMessage,
			uniPopupDialog
		}
		,props:{
			type:String,
			confirmBtn:Function,
			message:String,
			message_type:String
		}
		,data() {
			return {
				
			};
		}
		,methods:{
			open(){
				// console.log(this.type);
				this.$refs["popup_"+this.type].open();
			}
			,confirm(done){
				done();
				this.confirmBtn();
				
			}
		}
	}
</script>

<style>

</style>
